<script src="script.js"></script>

监听开关：<input type="checkbox" onchange="toggle(this.checked)" />